package com.xxl.job.admin.dao;

import com.xxl.job.admin.core.model.XxlJobGroup;
import com.xxl.job.admin.core.model.XxlJobInfo;
import org.apache.ibatis.annotations.Param;

/**
 * jaws job 基于 xxl job DAO扩展
 *
 * @author liangqm
 * @date 2018-07-23 8:28:18
 * @since v1.0.0
 */
public interface JawsJobGovernDao {

	/**
	 * 根据执行器名称查询ID
	 *
	 * @param groupName 执行器名称
	 * @return 执行器ID
	 * @author liangqm
	 * @date 2018-07-23 8:28:18
	 * @since v1.0.3
	 */
	Integer findGroupByName(@Param("groupName") String groupName);

	/**
	 * 插入执行器，返回ID
	 *
	 * @param xxlJobGroup 执行器信息
	 * @return 执行器ID
	 * @author liangqm
	 * @date 2018-07-23 8:28:18
	 * @since v1.0.3
	 */
	Integer saveXxlJobGroup(XxlJobGroup xxlJobGroup);

	/**
	 * 更新执行器
	 *
	 * @param xxlJobGroup 执行器信息
	 * @return 执行条数
	 * @author liangqm
	 * @date 2018-07-23 8:28:18
	 * @since v1.0.3
	 */
	Integer updateXxlJobGroup(XxlJobGroup xxlJobGroup);

	/**
	 * 查询JobHandler
	 *
	 * @param jobGroup        执行器ID
	 * @param executorHandler 执行器名称
	 * @return JobHandler信息
	 * @author liangqm
	 * @date 2018-07-23 8:28:18
	 * @since v1.0.3
	 */
	XxlJobInfo findJobHandler(@Param("jobGroup") int jobGroup,@Param("executorHandler") String executorHandler);

	/**
	 * 插入 JobHandler
	 *
	 * @param xxlJobInfo JobHandler信息
	 * @author liangqm
	 * @date 2018-07-23 8:28:18
	 * @since v1.0.3
	 */
	void saveJobHandler(XxlJobInfo xxlJobInfo);

	/**
	 * 更新 JobHandler
	 *
	 * @param xxlJobInfo JobHandler信息
	 * @return
	 * @author liangqm
	 * @date 2018-07-23 8:28:18
	 * @since v1.0.3
	 */
	void updateJobHandler(XxlJobInfo xxlJobInfo);
}
